<template>
  <ConfigForm :configs="createForm" :server="{ post: arrearsDdiscount }" />
</template>

<script setup lang="jsx">
import { arrearsDdiscount } from '@/api/arrears'
import ConfigForm from '@/components/CRUD/ConfigForm.vue'

const props = defineProps({
  info: {
    type: Object,
  },
})

const createForm = [
  {
    label: '',
    key: 'arrears_data_id',
    type: 'custom',
    defaultValue: props.info.arrears_data_id,
    render: () => (
      <div class="flex w-full gap-4">
        <span>{`${props.info.company_name}/${props.info.community_name}`}</span>
        <span>{props.info.address}</span>
        <span>{props.info.name}</span>
        <span>{props.info.mobile}</span>
        <span>{props.info.case_reason}</span>
      </div>
    )
  },
  {
    label: '减免金额',
    key: 'discount_amount',
    type: 'number',
    required: true,
    props: { placeholder: '请输入减免金额', precision: 2, min: 0, max: props.info.last_amount },
  },
]
</script>